Skip to content

[Air #1944] feat: Raise the Node.js floor to 22 and standardise CI on Node 22 - #1962

Open
amrmelsayed wants to merge 14 commits into
mainfrom
builder/air-1944
Open

amrmelsayed wants to merge 14 commits into
mainfrom
builder/air-1944

Conversation

@amrmelsayed

@amrmelsayed amrmelsayed commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Node 22 is now Codev's floor and the one version CI tests. Node 20 (EOL 2026-04-30) is dropped everywhere: engines, codev doctor, every POSIX and Windows workflow, the Windows guard message, and the docs.

Closes #1944

What Changed

  • engines: packages/codev/package.json engines.node >=20.0.0 → >=22.0.0. pnpm publish --dry-run / pnpm pack show "engines": { "node": ">=22.0.0" } in the packed manifest.
  • engine-strict: the repo tracks no .npmrc, so nothing sets engine-strict. A below-floor install on POSIX warns (npm's EBADENGINE) and proceeds. On native Windows the preinstall guard still refuses any Node whose ABI has no better-sqlite3 prebuild (Node 20 included).
  • POSIX CI: all eleven node-version: '20' lines in test.yml, e2e.yml, dashboard-e2e.yml, sdk-canary.yml and post-release-e2e.yml → '22' (architect confirmed open question 1).
  • Windows CI (windows.yml): every job on Node 22.
    • Probe matrix is now os: [windows-latest, windows-11-arm] only. The matrix.node == '22' conditions and continue-on-error: ${{ matrix.node == '20' }} are gone; artifact names lost their -node<N> suffix.
    • unit, cli-e2e, post-release-e2e: Node 24 legs dropped, no matrix.
    • install-guard: the Node 20 control and refusal steps are removed (open question 2, issue default, confirmed by the architect). The job keeps the Node 22 --supported check. The unit tests cover the guard's decision and message only. Nothing now checks on a real host that an unsupported install aborts before node-gyp (owner ruling: drop the leg and say so in the comments). scripts/windows-install-guard-check.mjs keeps its --control / --unsupported modes for manual runs.
  • Guard message: SUPPORTED_WINDOWS_NODE is 'Node.js 22 (LTS), x64 or arm64' and the advice line says "Install Node.js 22 (for example: winget install OpenJS.NodeJS.22)". The old OpenJS.NodeJS.LTS id now installs Node 24. OpenJS.NodeJS.22 was checked against the winget-pkgs manifests. Both parity twins changed (scripts/native-deps-guard.mjs, src/lib/native-deps.ts) and the install-guard check script. The ABI allow list did not change, so a newer Node with prebuilds still installs; it is just untested.
  • Docs: README install table and Windows line; DEPENDENCIES.md in both codev/ and codev-skeleton/ (Node section, support table, Windows table, troubleshooting); arch.md requirements line; cloud-instances.md setup_20.x → setup_22.x; the #1819 lesson now says "CI pins Node 22". None of them calls 24 tested.
  • More stale floors (found by CMAP): the VS Code walkthrough (apps/vscode/walkthroughs/install.md, said 20+), INSTALL.md (said 18+), resources/commands/codev.md in both trees (said doctor >= 18.0.0), all four skills/codev/SKILL.md copies (said >=18, so the shipped skill hashes were regenerated), the arch.md Windows install bullet, and a second lessons-learned line. A keep-files.ts comment that cited "engines allows 20.0" was trimmed.
  • @types/node: stays 22.x, unchanged.

Adjacent fix

codev doctor checked Node against minVersion: '18.0.0', below even the old floor. It is now 22.0.0, so doctor fails on Node 20 with need >= 22.0.0.

Node 22 defect fixed: node-pty loaded through one loader

Moving CI to Node 22 made Tower Integration Tests fail on every commit: three tower-api.e2e tests got a 500 nodePty.spawn is not a function from POST /api/terminals.

Root cause. PtySession.spawn() (the non-persistent path) loaded node-pty with await import('node-pty'). On Node 22.17 and later, in the pnpm workspace, after a workspace activation Tower's ESM resolver resolved node-pty through the package's pnpm symlink instead of its real path. node-pty was then loaded a second time under that key, and import() returned the copy's empty bindings (default an empty object, spawn undefined). The real-path copy was fully loaded. Measured locally with the same build and test: Node 22.16 passes, 22.19 and 22.23 fail. CI on Node 20 never hit it. This affects dev and CI only: a published install has no pnpm symlinks.

Fix. A new terminal/node-pty-loader.ts (loadNodePty()) loads node-pty with createRequire and keeps the Spec 1658 native-load explanation. Both pty-session.ts and shellper-main.ts use it, so node-pty now loads in exactly one way. shellper-main.ts already used createRequire + withNativeLoadExplanation, so its behaviour is unchanged. pty-session-native-load.test.ts and pty-terminal-type.test.ts now mock the loader instead of node-pty, with the same assertions. The new node-pty-loader.test.ts checks that the loader returns the same instance require holds, with a callable spawn. tower-api.e2e.test.ts is unchanged. The send-integration.e2e comment that described the problem as unfixed is updated; its persistent: true stays. One line was added to lessons-learned.

Local, Node 22.23.4: Tower integration suite 175 passed (it failed 3 before), full unit suite 8446 passed, tsc clean.

Key Decisions

  • The architect confirmed both open questions: POSIX CI moves to 22, and the Node 20 install-guard leg is removed.
  • The probe keeps an OS matrix (x64 + ARM64) but no longer has a Node axis.

Test Plan

  • doctor.test.ts: new test checks that Node 20 fails doctor with need >= 22.0.0. Fixtures moved v20 → v22.
  • native-deps-guard.test.ts: the engines assertion is now >=22.0.0; guard-message assertions are updated in all four test files that check the wording.
  • pnpm build and tsc --noEmit clean; full codev unit suite: 415 files / 8444 tests passed.
  • pnpm publish --dry-run / pack: packed engines.node is >=22.0.0.
  • POSIX CI on Node 22 (this PR's checks), including dashboard-e2e and sdk-canary. Tower Integration was red on every head before the node-pty loader fix (0966555).
  • Windows workflow, suites + install guard, every job on Node 22, green: https://github.com/cluesmith/codev/actions/runs/45303227286 (head eb1d387)
  • Windows run on the final head 0966555 (terminal code changed): https://github.com/cluesmith/codev/actions/runs/45309730646
  • Earlier Windows run on head f6b8651, all green (probes x64 + ARM64, install guard, unit, CLI, install verification): https://github.com/cluesmith/codev/actions/runs/45304777686
    (The later commit only changes comments in windows.yml: it corrects the stale "about 50 minutes" / "about an hour" duration claims to the measured ~7 minute unit suite and ~10 minute run. Timeouts are unchanged, so no new run is needed.)

Grep check: 20+, Node 20, setup_20 and 22 or 24 were searched across codev/ and codev-skeleton/. The only hits left are historical specs, plans and reviews, plus the new "Node 20 is not supported" line.

CMAP

  • gemini: skipped (agy not authenticated; non-blocking)
  • codex: REQUEST_CHANGES → addressed (winget id; stale floors in arch.md, codev.md twins, lessons-learned, keep-files.ts)
  • claude: REQUEST_CHANGES → addressed (same stale floors plus the VS Code walkthrough and the four SKILL.md copies; winget id verified to exist; comment nits on the ABI list and the install-guard script header)

Not changed: apps/streamdeck/esbuild.js target: 'node20' is an esbuild output target, not a statement of supported Node versions.

Release-notes flag: raising the floor breaks installs for Node 20 users. The entry belongs on the changelog branch.

Architect integration review (items 1-5, commit 0427bb3)

  1. codev doctor's Linux install hint now uses NodeSource setup_22.x, because stock apt install nodejs installs an older Node than 22.
  2. DEPENDENCIES.md (both copies): "Should show v22.x or newer".
  3. cloud-instances.md Installed Tools: Node.js v22.x.
  4. keep-files.ts expand: the comment now explains why the directory walk is done by hand (recursive also returns directories and joins with path.sep; this function keeps regular files only and builds /-separated paths).
  5. The native-deps-guard.test.ts title now says the prebuild set is broader than the tested Node 22.
  • Same defect as item 1: the Ubuntu/Debian quick-install block in DEPENDENCIES.md (both copies) also used stock apt install nodejs npm. It now adds the NodeSource setup_22.x step first.

Item 6, owner ruling: the leg stays dropped. The windows.yml header and the native-deps-guard.test.ts header now say the real install abort is no longer checked on a host.

Review Notes

Read windows.yml closely: it is the only change with structure (the matrix collapse and the install-guard trim). Everything else is a value or wording change.

… Node 22

- engines.node >=22.0.0; codev doctor's Node minimum 18.0.0 -> 22.0.0
- POSIX workflows: node-version 20 -> 22
- windows.yml: every job on Node 22; Node 20 install-guard leg removed
- Guard message names Node.js 22 (both parity twins); ABI allow list unchanged
- Docs: README, DEPENDENCIES.md (both trees), arch.md, cloud-instances.md, lessons-learned.md
@amrmelsayed

Copy link
Copy Markdown
Collaborator Author

Architect integration review (main)

Tier: high by file count (33 files), so 3-way. gemini skipped (agy not signed in, non-blocking); codex and claude both returned REQUEST_CHANGES. I checked every claim against the branch at 77bc8d7da. The floor raise itself is consistent: engines, doctor, all sixteen setup-node sites, the four SKILL.md copies and their hash, and both DEPENDENCIES.md copies agree.

Fix in this PR

  1. codev doctor Linux install hint cannot satisfy the new minimum. doctor.ts keeps linux: 'apt install nodejs npm', which gives Node 18 on Ubuntu 24.04 and Node 20 on Debian 13. With minVersion now 22.0.0, the hint leads to a failing doctor. Point it at the NodeSource setup_22.x route that DEPENDENCIES.md already prescribes. (The Windows user seeing the Linux hint is older behaviour; leave it.)
  2. DEPENDENCIES.md (both copies): node --version # Should show v22.x contradicts "Minimum Version 22.0.0" and the README's "22+", and reads as "downgrade from 24". Make it "v22.x or newer".
  3. codev/resources/cloud-instances.md line 19 still lists Node.js v20.x under Installed Tools while the provisioning script in the same file is setup_22.x. Both reviewers flagged it; make it v22.x. The grep set in the PR body did not match v20.x.
  4. keep-files.ts expand comment. The Node 20.1 reason is gone, but the hand-walk is still deliberate: readdirSync({ recursive: true }) returns directories and path.sep-joined names, and expand keeps regular files only and builds /-separated paths. Say that, so nobody "simplifies" it.
  5. native-deps-guard.test.ts test title "passes Node 22 and 24 ... (the audited prebuild set)": add that the set is broader than the tested version, matching the source comment.

Waiting on the owner (do not change yet)

  1. Install-guard refusal leg. Verified: the unit tests cover the pure decision function and the message twins. No test asserts preinstall.mjs exits non-zero (the one spawn asserts status 0 on the no-op branch, and the script reads process.platform directly), and nothing else proves npm runs preinstall before a dependency's node-gyp fallback. The removed --control and --unsupported steps were the only real-host proof of that. So the two comments that say the refusal is "covered by its unit tests" (windows.yml header, the test file header) overstate it. Either the leg comes back as the one exception, or the comments are corrected to say the real install abort is no longer checked on a host. I am taking that choice to the owner and will relay it.

Checked and not a change

  • MIGRATION-1.0.md "18+": the file is the deprecated v1.0.x guide, slated for removal. Leave it.
  • claude's point that the dropped Node 24 legs "caught a real defect" in the Windows: show and end orphaned processes left in a session after an agent command times out #1915 lane: the thread records those two Node 24 failures as runner load flakes that passed on rerun, so this is not evidence against the owner's Node 22 only decision. No change.
  • apps/streamdeck/esbuild.js target: 'node20': an output target, correctly untouched.

After the fixes

A commit that touches windows.yml or anything beyond docs and comments needs a fresh Windows dispatch on the final head. Wait for the ruling on item 6 before dispatching, so the long run happens once.

Follow-up candidates I will raise with the owner separately, not for this PR: a start-up Node version check for POSIX (the floor is advisory there: EBADENGINE warns and the install proceeds), and an optional dispatch input to spot-check a newer Node on Windows at release time.

amrmelsayed added a commit that referenced this pull request Nov 24, 2026
…changes and contributors drafted for the next patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Raise the Node.js floor to 22, drop Node 20, and standardise CI on Node 22

1 participant